<template>
	<view class="con">
		<view @click="changeActiveItem(item)" class="box" v-for="(item,index) in barList" :key="index"
			:class="{active : item.id == activeIndex}">
			<text>{{item.name}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			barList: {
				type: Array,
				default: []
			},
			activeIndex: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {

			}
		},
		methods: {
			changeActiveItem(id) {
				this.$emit('changeActiveItem', id)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.active {
		border-bottom: 1px solid red;
	}

	.con {
		width: 100%;
		display: flex;
		height: 100rpx;
		// border-bottom: 1rpx solid rgba(229, 229, 229, 1);

		.box {
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			flex: 1;

			text {
				font-size: 36rpx;
				font-weight: 500;
			}

		}
	}
</style>
